package com.mdw.jsontest.jdbc;

import java.sql.*;

public class BDUtil {
    private static final String URL = "jdbc:h2:D:\\IdeaProjects\\StudentJson\\test;MODE=MYSQL;DB_CLOSE_DELAY=-1";
    private static final String NAME = "sa";
    private static final String PASSWORD = "sa";

    public static void main(String[] args) {

        try (Connection conn = DriverManager.getConnection(URL, NAME, PASSWORD)) {

            Statement stmt = conn.createStatement();

            stmt.executeUpdate(
                    "CREATE TABLE IF NOT EXISTS `user` (" +
                            "  `name` varchar(100) NOT NULL," +
                            "  `age` int(11) NOT NULL," +
                            "  PRIMARY KEY (`name`)" +
                            ");"
            );

            ResultSet rs = stmt.executeQuery("select * from user");//选择import java.sql.ResultSet;

        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
